﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="EntityManager.aspx.cs" Inherits="Apollo.Website.EntityManager" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <script type="text/javascript" language="javascript">
        $(document).ready(function () {
            $("#chkAllMap").click(function () {
                var checkedAll = $("#chkAllMap").attr('checked');
                $(".chkMap :checkbox").attr('checked', checkedAll);
            });
            $("#chkAllView").click(function () {
                var checkedAll = $("#chkAllView").attr('checked');
                $(".chkView :checkbox").attr('checked', checkedAll);
            });
            $("#chkAllMenu").click(function () {
                var checkedAll = $("#chkAllMenu").attr('checked');
                $(".chkMenu :checkbox").attr('checked', checkedAll);
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="body" Runat="Server">


        <div class="ui-state-hover">
            <div class="center-menu">
                <span><asp:LinkButton ID="LinkButton1" runat="server" Text="Generate" onclick="ButtonSave_Click" CssClass="btn_run" /></span>
                
            </div>
            <div class="clear"></div>
        </div>
    
        <div id="entity_header" class="ui-state-highlight" runat="server" visible="false">
            <asp:Image ID="ImageWarn" runat="server" ImageUrl="/css/icons/icon_38.png" Visible="false"/>
            <asp:Label ID="LabelWarn" runat="server" Text="Tables were generated" CssClass="warn" Visible="false"></asp:Label>
        </div>
        
        <div class="ui-state-default ui-jqgrid-hdiv">
            <div class="ui-jqgrid-hbox">
                <table class="ui-jqgrid-htable" width="100%">
                    <tr>
                        <th class="ui-state-default ui-th-column ui-th-ltr ui-jqgrid">Entity</th>
                        <th class="ui-state-default ui-th-column ui-th-ltr ui-jqgrid"><input type="checkbox" id="chkAllMap" />Mappings</th>
                        <th class="ui-state-default ui-th-column ui-th-ltr ui-jqgrid"><input type="checkbox" id="chkAllView" />Default view</th>
                        <th class="ui-state-default ui-th-column ui-th-ltr ui-jqgrid"><input type="checkbox" id="chkAllMenu" />Menu item</th>
                        
                    </tr>
                    <asp:Repeater ID="RepeaterEntities" runat="server">
                    <ItemTemplate>
                    <tr class="ui-widget-content jqgrow ui-row-ltr">
                        <td class="ui-jqgrid"><asp:Label ID="LabelEntity" runat="server" Text='<%# Eval("Name") %>'></asp:Label></td>
                        <td><asp:CheckBox ID="CheckBoxEntity" runat="server" CssClass="chkMap" Visible='<%# !this.ExistsInDb((string)Eval("Name")) %>' /></td>
                        <td><asp:CheckBox ID="CheckBoxDefaultView" runat="server" CssClass="chkView" Visible='<%# !this.HasDefaultView((string)Eval("Name")) %>' /></td>
                        <td><asp:CheckBox ID="CheckBoxMenuItem" runat="server" CssClass="chkMenu" Visible='<%# !this.HasMenuItem((string)Eval("Name")) %>' /></td>
                    </tr>
                    </ItemTemplate>
                    </asp:Repeater>
                </table>    
            </div>
        </div>
        
</asp:Content>

